package org.rcy.framework.security.form;

import org.rcy.framework.security.exception.Assertion;

public class UsernameAssertion implements Assertion<String> {
    private final String username;

    public UsernameAssertion(String username) {
        this.username = username;
    }

    public String getValue() {
        return this.username;
    }

    public String toString() {
        return "AccountAssertion [username=" + this.username + "]";
    }

    public int hashCode() {
        boolean prime = true;
        int result = 1;
        result = 31 * result + (this.username == null ? 0 : this.username.hashCode());
        return result;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (this.getClass() != obj.getClass()) {
            return false;
        } else {
            UsernameAssertion other = (UsernameAssertion)obj;
            if (this.username == null) {
                if (other.username != null) {
                    return false;
                }
            } else if (!this.username.equals(other.username)) {
                return false;
            }

            return true;
        }
    }
}